package com.diallom.parkingnord;



import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.Toast;

import com.diallom.R;
import com.diallom.bd.ParkingDAO;

public class ParkingNord extends Activity {
	private ImageButton parking,voiture;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_parking_nord);
		/**
		 * Recuperation des boutons de la page d'accueil
		 */
		parking= (ImageButton) findViewById(R.id.ic_parking);
		voiture= (ImageButton) findViewById(R.id.iic_retrouver);
		/**
		 * add acouteur sur le bouton 
		 */
		parking.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(ParkingNord.this,ListParking.class);
				startActivity(intent);
			}

		});
		voiture.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Toast.makeText(ParkingNord.this, "Coucou !", Toast.LENGTH_SHORT).show();
			}

		});
	}
	

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.layout.menu, menu);
 
    	menu.getItem(0).getSubMenu().setHeaderIcon(R.drawable.ic_launcher);
		return true;
	}
	@Override
    public boolean onOptionsItemSelected(MenuItem item) {
       switch (item.getItemId()) {
          case R.id.option:
        	  startActivity(new Intent(this,ParkingDAO.class));
             return true;
          case R.id.favoris:
              Toast.makeText(ParkingNord.this, "Favoris", Toast.LENGTH_SHORT).show();
              return true;
          case R.id.stats:
              Toast.makeText(ParkingNord.this, "Stats", Toast.LENGTH_SHORT).show();
              return true;
         case R.id.quitter:
             finish();
             return true;
       }
       return false;
    }
	
	public void newParking(View view){
		startActivity(new Intent(this,ParkingDAO.class));
	}
	
}
